<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }
    //或者各类型协议内容
    public function get_agreement()
    {
        $type = $this->request->param('type','user_agreement');
        $info = db('config')->where('name',$type)->find();
        if (!$info) {
            $this->error('协议不存在');
        }
        $this->success('请求成功', $info['value']);
    }

    public function get_banner()
    {
        $type = $this->request->param('type','1');
        $list = model('bannerimage')->where(['type'=>$type])->field('id,image,url')->order('weigh desc')->select();
        $this->success('请求成功', $list);
    }
}
